package com.xiyu.service.repository.infra.rate;

import com.xiyu.service.model.infra.rate.InfraExchangeRate;
import com.xiyu.service.model.infra.rate.InfraExchangeRateTable;
import org.babyfish.jimmer.spring.repository.JRepository;

import java.util.Optional;
import java.util.List;

public interface InfraExchangeRateRepository extends JRepository<InfraExchangeRate, Long> {
    InfraExchangeRateTable infraExchangeRateTable = InfraExchangeRateTable.$;

    Optional<InfraExchangeRate> findByCurrency(String currency);

    default List<InfraExchangeRate> listQuery(){
        return sql().createQuery(infraExchangeRateTable)
                .orderBy(infraExchangeRateTable.id().desc())
                .select(infraExchangeRateTable).execute();
    }


}